<!DOCTYPE html>
<html class="ui-page-login">

	<head>
		<meta charset="utf-8">
		<meta name="viewport" content="width=device-width,initial-scale=1,minimum-scale=1,maximum-scale=1,user-scalable=no" />
<title>2017延长壳牌供应链日</title>
		
		<link href="webpages/wx/pzsw/mui/css/mui.min.css" rel="stylesheet" />
		<style>
			.area {
				margin: 20px auto 0px auto;
			}
			.mui-input-group:first-child {
				margin-top: 20px;
			}
			.mui-input-group label {
				width: 22%;
			}
			.mui-input-row label~input,
			.mui-input-row label~select,
			.mui-input-row label~textarea {
				width: 78%;
			}
			.mui-checkbox input[type=checkbox],
			.mui-radio input[type=radio] {
				top: 6px;
			}
			.mui-content-padded {
				margin-top: 25px;
			}
			.mui-btn {
				padding: 10px;
			}
			.mui-input-row label~input, .mui-input-row label~select, .mui-input-row label~textarea{
				margin-top: 1px;
			}
		</style>
		<script type="text/javascript"
	src="static/plugins/jquery/jquery-1.8.3.min.js"></script>
	</head>

	<body>
		<header class="mui-bar mui-bar-nav">
			<h1 class="mui-title">${(user.nickname)!}</h1>
		</header>
		<div class="mui-content">
			<div class="mui-content-padded mui-text-center">
				<h1><img src="${(user.headImgUrl)!}" style="width: 100px;"></h1>
			</div>
            	<form class="mui-input-group">
				<div class="mui-input-row">
					<label>姓名</label>
					<input id='name' type="text" class="mui-input-clear mui-input" placeholder="">
				</div>
				<div class="mui-input-row">
					<label>单位</label>
					<input id='position' type="text" class="mui-input-clear mui-input" placeholder="">
				</div>
			</form>
			
			<div class="mui-content-padded">
				<button id='sendMail' class="mui-btn mui-btn-block mui-btn-primary">签到</button>
			</div>
		</div>
		<script src="webpages/wx/pzsw/mui/js/mui.min.js"></script>
		<script src="webpages/wx/pzsw/mui/js/app.js"></script>
		<script>
			(function($, doc) {
				$.init();
// 				$.plusReady(function() {
					var sendButton = doc.getElementById('sendMail');
					var name = doc.getElementById('name');
					var position = doc.getElementById('position');
					sendButton.addEventListener('tap', function() {
						
						var data = {
			    				openId:'${(user.openId)!}',
			    				nickName:'${(user.nickname)!}',
			    				sex:'${(user.sex)!}',
			    		        country:'${(user.country)!}',
			    		        province:'${(user.province)!}',
			    		        city:'${(user.city)!}',
			    		        headImgUrl:'${(user.headImgUrl)!}',
			    		        companyCode:'${companyCode!}',
			    		        position:position.value,
			    		        name:name.value
			    		};
						console.log(data);
						if(!name.value) {
				   			alert('请填写完整姓名信息');
				   			return;
				   		}
						
						$.ajax({
			    			type : "POST",
			    			url : "signWxUserInfo.action",
			    			data : data, //序列化   
			    			dataType:'json',
			    			error : function(request) { // 设置表单提交出错 
			    				mui.toast('签到失败');
			    			},
			    			success : function(data) {
			    				if(data.success) {
			    					window.location.href='signResult.action?openId='+data.obj.openId;
			    				} else {
			    					alert(data.msg);
			    				}
			    			}
			    		});
					}, false);
// 				});
			}(mui, document));
		</script>
	</body>

</html>